package com.scuthnweb.tool;

public class FilteDataUtil {
	
	public static String filtXSS(String input){
		input = input.replace("<", "&lt;");
		input = input.replace(">", "&gt;");
		
		input = input.replace("&lt;p&gt;", "<p>");
		input = input.replace("&lt;/p&gt;", "</p>");
		
		input = input.replace("&lt;a", "<a");
		input = input.replace("\"&gt;", "\">");		
		input = input.replace("&lt;/a&gt;", "</a>");		

		input = input.replace("&lt;em&gt;", "<em>");
		input = input.replace("&lt;/em&gt;", "</em>");
		
		input = input.replace("&lt;li&gt;", "<li>");
		input = input.replace("&lt;/li&gt;", "</li>");

		input = input.replace("&lt;ul&gt;", "<ul>"); 
		input = input.replace("&lt;/ul&gt;", "</ul>");	
		
		input = input.replace("&lt;ol&gt;", "<ol>");
		input = input.replace("&lt;/ol&gt;", "</ol>");	

		input = input.replace("&lt;strong&gt;", "<strong>");
		input = input.replace("&lt;/strong&gt;", "</strong>");	

		input = input.replace("style=\"", "style=&quot;");
		input = input.replace("onclick=\"", "onclick=&quot;");
		input = input.replace("onabort=\"", "onabort=&quot;");
		input = input.replace("onblur=\"", "onblur=&quot;");
		input = input.replace("onchange=\"", "onchange=&quot;");
		input = input.replace("ondblclick=\"", "ondblclick=&quot;");
		input = input.replace("onerror=\"", "onerror=&quot;");
		input = input.replace("onfocus=\"", "onfocus=&quot;");
		input = input.replace("onkeydown=\"", "onkeydown=&quot;");
		input = input.replace("onkeypress=\"", "onkeypress=&quot;");
		input = input.replace("onkeyup=\"", "onkeyup=&quot;");
		input = input.replace("onload=\"", "onload=&quot;");
		input = input.replace("onmousedown=\"", "onmousedown=&quot;");
		input = input.replace("onmousemove=\"", "onmousemove=&quot;");
		input = input.replace("onmouseout=\"", "onmouseout=&quot;");
		input = input.replace("onmouseover=\"", "onmouseover=&quot;");
		input = input.replace("onmouseup=\"", "onmouseup=&quot;");
		input = input.replace("onreset=\"", "onreset=&quot;");
		input = input.replace("onresize=\"", "onresize=&quot;");
		input = input.replace("onselect=\"", "onselect=&quot;");
		input = input.replace("onsubmit=\"", "onsubmit=&quot;");
		input = input.replace("onunload=\"", "onunload=&quot;");

		return input;
	}

}
